package com.union.vehicleassistant.http.api;

import androidx.annotation.NonNull;

import com.hjq.http.config.IRequestApi;
import com.hjq.http.config.IRequestBodyStrategy;
import com.hjq.http.config.IRequestType;
import com.hjq.http.config.impl.RequestJsonBodyStrategy;

/**
 * author : Android 轮子哥
 * github : https://github.com/getActivity/AndroidProject
 * time   : 2019/12/07
 * desc   : 用户登录
 */
public final class LoginApi implements IRequestApi, IRequestType {

    @Override
    public String getApi() {
        return "system/auth/loginByPwd";
    }

    /**
     * 手机号
     */
    private String username;
    /**
     * 登录密码
     */
    private String password;
    private String code;
    private String sessionId;

    public LoginApi setUsername(String username) {
        this.username = username;
        return this;
    }

    public LoginApi setPassword(String password) {
        this.password = password;
        return this;
    }

    public LoginApi setCode(String code) {
        this.code = code;
        return this;
    }

    public LoginApi setSessionId(String sessionId) {
        this.sessionId = sessionId;
        return this;
    }

    @NonNull
    @Override
    public IRequestBodyStrategy getBodyType() {
        return new RequestJsonBodyStrategy();
    }

    public final static class Bean {

        private String access_token;

        public String getAccessToken() {
            return access_token;
        }
    }
}